<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html >
<html>
<head>
<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
</head>
<body style="background-color: white;" class="gray-bg">
	<div class="ibox-content">
		<div class="row">
			<div class="col-sm-12">
				<table class="table table-bordered">
						<thead>
							<tr>
								<th>沟通事项</th>
								<th>沟通方式</th>
								<th>沟通目的</th>
								<th>沟通内容</th>
								<th>沟通时间</th>
								<th>沟通人</th>
								<th>面试记录</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${communicates }" var="communicate">
							<tr>
								<td>${fns:getDictLabel(communicate.classid,'resume_status','')}</td>
								<td>${communicate.methods }</td>
								<td>${communicate.purpose }</td>
								<td>${communicate.details }</td>
								<td>${communicate.createDate }</td>
								<td>${communicate.userupdate.truename }</td>
								<td><a onclick="openrecord(&quot;${communicate.id}&quot;);" class="btm-sm btn-link">查看详请</a></td>
								<td>
								   <c:if test="${recommend.isPast eq 1}">
								   <c:if test="${communicate.classid eq 2 || communicate.classid eq 3 || communicate.classid eq 4 }">
								    <a class="btn-sm btn-primary" onclick="addfeedback(&quot;${communicate.id}&quot;,&quot;${communicate.recommendId}&quot;)">面试反馈</a>&nbsp;&nbsp;
								    </c:if>
								    <c:if test="${communicate.classid eq 5}">
								    <a class="btn-sm btn-primary" onclick="addsurvey(&quot;${communicate.id}&quot;,&quot;${communicate.recommendId}&quot;)">背调反馈</a>&nbsp;&nbsp;
								    </c:if>
								    <c:if test="${communicate.classid eq 6}">
								    <a class="btn-sm btn-primary" onclick="addoffer(&quot;${communicate.id}&quot;,&quot;${communicate.recommendId}&quot;)">添加offer</a>&nbsp;&nbsp;
								    </c:if>
								    <c:if test="${communicate.classid eq 7}">
								    <a class="btn-sm btn-primary" onclick="addentry(&quot;${communicate.id}&quot;,&quot;${communicate.recommendId}&quot;)">入职反馈</a>&nbsp;&nbsp;
								    <a class="btn-sm btn-info" onclick="addinvoice(&quot;${communicate.projectId}&quot;)">开票</a>&nbsp;&nbsp;
								    </c:if>
								   <a class="btn-sm btn-warning" onclick="addresult(&quot;${communicate.recommendId}&quot;,&quot;${communicate.companyId}&quot;,&quot;${communicate.projectId}&quot;,&quot;${communicate.telentsId}&quot;)">沟通结果</a>
								   </c:if>
								</td>
							</tr>
							</c:forEach>
							<c:if test="${empty communicates}">
							  <tr><td colspan="6" align="center">暂无数据！</td></tr>
							</c:if>
						</tbody>
					</table>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	function addfeedback(id,recommendId) {
		swal({ 
			title: "是否参加面试？", 
			type: "warning", 
			showCancelButton: true, 
			confirmButtonColor: "#DD6B55", 
			confirmButtonText: "No", 
			cancelButtonText: "Yes", 
			closeOnConfirm: false, 
			closeOnCancel: false 
			}, 
			function(isConfirm) { 
				if (isConfirm) { 
					swal({
   		    			title:"即将进入下一环节",
   		    			text: "1秒后自动关闭。", 
   		    			timer: 1000, 
   					    showConfirmButton: false
   		    		});
					openyem("反馈面试人结果", "<%=contextPath%>/recommendResult/addView?recommandId=" + recommendId, 600, 500);
					} else{ 
						swal({
       		    			title:"即将进入下一环节",
       		    			text: "1秒后自动关闭。", 
       		    			timer: 1000, 
       					    showConfirmButton: false
       		    		});
						openyem("添加面试记录", "<%=contextPath%>/demandInterview/addView?communicateId=" + id +"&recommendId=" + recommendId, 500, 550);
						
					} 
				})
	}
	function addresult(recommendId,companyId,demandId,talentsId) {
		swal({ 
			title: "该人才是否通过？", 
			type: "warning", 
			showCancelButton: true, 
			confirmButtonColor: "#DD6B55", 
			confirmButtonText: "No", 
			cancelButtonText: "Yes", 
			closeOnConfirm: false, 
			closeOnCancel: false 
			}, 
			function(isConfirm) { 
				if (isConfirm) { 
					swal({
   		    			title:"即将进入下一环节",
   		    			text: "1秒后自动关闭。", 
   		    			timer: 1000, 
   					    showConfirmButton: false
   		    		});
					openyem("反馈推荐结果", "<%=contextPath%>/recommendResult/addView?recommendId=" + recommendId, 600, 500);
					} else{ 
						swal({
       		    			title:"即将进入下一环节",
       		    			text: "1秒后自动关闭。", 
       		    			timer: 1000, 
       					    showConfirmButton: false
       		    		});
						openyem("添加沟通记录", "<%=contextPath%>/demandCommunicate/addView?talentsId=" + talentsId+"&recommendId=" + recommendId +"&companyId=" + companyId+"&demandId="+demandId, 500, 550);
						
					} 
				})
	}
	function openrecord(id) {
		openyem("查看面试记录", "<%=contextPath%>/demandInterview/list?communicateId=" + id, 850, 750);
	}
	
	function addsurvey(id,recommendId) {
		swal({ 
			title: "是否背景调查？", 
			type: "warning", 
			showCancelButton: true, 
			confirmButtonColor: "#DD6B55", 
			confirmButtonText: "No", 
			cancelButtonText: "Yes", 
			closeOnConfirm: false, 
			closeOnCancel: false 
			}, 
			function(isConfirm) { 
				if (isConfirm) { 
					swal({
   		    			title:"即将进入下一环节",
   		    			text: "1秒后自动关闭。", 
   		    			timer: 1000, 
   					    showConfirmButton: false
   		    		});
					openyem("反馈调查结果", "<%=contextPath%>/recommendResult/addView?recommendId=" + recommendId, 600, 500);
					} else{ 
						swal({
       		    			title:"即将进入下一环节",
       		    			text: "1秒后自动关闭。", 
       		    			timer: 1000, 
       					    showConfirmButton: false
       		    		});
						openyem("添加背景调查", "<%=contextPath%>/demandInvestigation/addView?communicateId=" + id +"&recommendId="+recommendId, 800, 750);
						
					} 
				})
	}
	function addoffer(id,recommendId) {
		openyem("添加offer记录", "<%=contextPath%>/demandOfferRecord/addView?communicateId=" + id +"&recommendId="+recommendId, 500, 550);
	}
	function addentry(id,recommendId) {
		openyem("添加入职记录", "<%=contextPath%>/demandOfferRecord/addView?communicateId=" + id +"&recommendId="+recommendId, 500, 550);
	}
	function addinvoice(id) {
		openyem("添加开票信息", "<%=contextPath%>/invoice/addView?demandId=" + id, 500, 550);
	}
	</script>
</body>
</html>